import AjaxForBusOpen from '@/utils/AjaxForBusOpen'

async function setReservationForm(
  depositAmount,
  numberOfPeople,
  numberOfVehicles,
  startPoint,
  stationList,
  endPoint,
  startTime,
  endTime,
  userName,
  userPhone,
  payment,
  secondUserName,
  secondUserPhone,
  eMail,
  remark
) {
  let postData = {
    DEPOSIT_AMOUNT: depositAmount,
    PASSENGER_NUM: numberOfPeople,
    SUBSCRIBE_CAR_NUM: numberOfVehicles,
    START_POINT: startPoint,
    VIA_ADDRESS: stationList,
    END_POINT: endPoint,
    TRIP_START_TIME: startTime,
    TRIP_END_TIME: endTime,
    CONTACT: userName,
    CONTACT_PHONE: userPhone,
    PAYMENT: payment,
    SECOND_CONTACT: secondUserName,
    SECOND_CONTACT_PHONE: secondUserPhone,
    OTHER_EMAIL: eMail,
    USER_MEMO: remark
  }
  let res = await AjaxForBusOpen(
    '/chartered-bus-api/chartered/bus_order/add',
    postData
  )
  let paymentObj = {
    payment: res.PAYMENT,
    orderNO: res.ORDER_NO,
    paymentStr: res.PAYMENT_STR
  }
  return paymentObj
}

export { setReservationForm }
